<?php
use yii\widgets\ActiveForm;
?>
<link rel="stylesheet" href="../static/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../static/jBox/Skins/Metro/jbox.css" type="text/css">
<link rel="stylesheet" href="../static/dist/css/AdminLTE.min.css" type="text/css">
<link rel="stylesheet" href="../static/css/admin.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/treeTable/jquery.treetable.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/treeTable/jquery.treetable.theme.default.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/datatables/jquery.dataTables.css" type="text/css">
<style>
    .ul_tree_display{
        display: none;
    }
    .tr_tree_display{
        display: none;
    }
    .dataTables_length{
        margin-top: 10px;
    }
    .dataTable>tbody>tr>td{
        vertical-align: middle;
        font-size: 0.8em;
        padding: 8px 18px;
    }
    .dataTable>thead>tr>th{
        vertical-align: middle;
        font-size: 0.8em;
    }

.modalBox{
  /*  bottom: auto !important;*/
    margin: 0 auto !important;
}
.modalBox .modal-dialog{
    margin-top: 10px !important;
}
.modalBox .form-group{
    margin-bottom:10px !important;
}
.modalBox .modal-header{
    padding: 10px 15px !important;
}
.modalBox .form-group .form-control{
  /*  height: 30px !important;
    padding: 0 12px !important;*/
}
.modalBox button{
    height: 30px;
    line-height: 1!important;
}
.modalBox .col-md-12{
    margin-left: -30px !important;
}
</style>
<div class="tabs-panel">
	<div class="row">
		<div class="col-xs-12">
			<div class="box">
				<div class="box-header">
                    文章标题：
                    <input class="depart-input" name="article_title" id="article_title" type="text" placeholder="" style="width: 150px">&nbsp;
                    <label>文章分类：</label>
                    <select id="category_id" name="category_id" class="depart-input" style="width: 150px">
                        <option value="">请选择</option>
                        <?php if (is_array($article_category) && count($article_category) > 0)foreach($article_category as $value){?>
                            <option value="<?= $value['id']?>"><?= $value['category_title']?></option>
                        <?php }?>
                    </select>&nbsp;
                    <button type="button" class="btn btn-primary depart-modal" onclick="table_list_reload()" style="width: 100px;">查询</button> &nbsp;
                    <button type="button" class="btn btn-warning depart-modal" id="reset_button" style="width: 100px;">重置</button>
                </div>
				<div class="box-body">
					<button type="button" class="btn btn-success depart-modal article-show-btn" style="width: 100px;">添加</button>
					<table id="tableid" class="table table-bordered table-hover">
						<thead>
							<tr>
								<th style="width:10%">操作</th>
								<th style="width:5%">ID</th>
								<th style="width:35%">文章标题</th>
								<th style="width:15%">SEO维护</th>
								<th style="width:15%">文章类型</th>
								<th style="width:5%">排序</th>
								<th style="width:5%"><?=TITLE_STATUS?></th>
								<th style="width:10%">发布</th>
							</tr>
						</thead>
						<tbody class="productTr">
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<div class="modal fade modalBox" id="article-modal" style="background: rgba(236, 230, 230, 0.3);" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 100%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">文章操作</h4>
            </div>
            <div class="modal-body">
                <form action="/article/change-article" method="post" name="article_form" id="article_form">
                    <div class="box-body">
                    	<div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>文章分类</label>
                            <select name="category_id" style="width: 25%;"  class="form-control">
                            	<?php if (is_array($article_category) && count($article_category) > 0)foreach($article_category as $value){?>
                                    <option value="<?= $value['id']?>"><?= $value['category_title']?></option>
                                <?php }?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>文章标题</label>
                            <input style="width: 50%;" class="form-control" name="article_title" placeholder="文章标题" type="text">
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>排序</label>
                            <input style="width: 50%;" class="form-control" name="sort" id="sort" placeholder="排序" type="text">
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">外部链接</label>
                            <input style="width: 50%;" class="form-control" name="article_link" id="article_link" placeholder="外部链接" type="text">
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">视频（PC）</label>
                            <input style="width: 50%;" class="form-control" name="video_url_pc" id="video_url_pc" placeholder="视频的链接" type="text">
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">视频（WAP）</label>
                            <input style="width: 50%;" class="form-control" name="video_url_wap" id="video_url_wap" placeholder="视频的链接" type="text">
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>状态</label>
                            <select name="use_flg" id="use_flg" style="width: 25%;"  class="form-control">
                            	<option value="1">启用</option>
                            	<option value="0">禁用</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">标识</label>
                            <select name="article_identification" id="article_identification" style="width: 25%;"  class="form-control">
                            	<option value="">请选择</option>
                            	<?php 
                            	if (is_array($goods_identification) && count($goods_identification) > 0)foreach ($goods_identification as $identification_val){
                            	    if ($identification_val['type'] != 3) continue;
                            	    ?>
                            	<option value="<?=$identification_val['id']?>"><?=$identification_val['name']?></option>
                            	<?php }?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">主要类别</label>
                            <select name="article_classification" id="article_classification" style="width: 25%;"  class="form-control">
                            	<option value="">请选择</option>
                            	<?php 
                            	if (is_array($goods_identification) && count($goods_identification) > 0)foreach ($goods_identification as $identification_val){
                            	    if ($identification_val['type'] != 2) continue;
                            	    ?>
                            	<option value="<?=$identification_val['id']?>"><?=$identification_val['name']?></option>
                            	<?php }?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">文章图片</label>
                            <button type="button" class="btn btn-success depart-modal upload-img-btn-main" style="width: 100px;">上传</button>
                            <input name="article_pic" id="article_pic" value="" class="form-control" type="hidden">
                            <button onclick="showImg($('#article_pic').val())" type="button" class="btn btn-success depart-modal show-img-btn hide">查看图片</button>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">文章概括</label>
                            <textarea class="form-control" style="width: 100%;" name="summary" id="summary" placeholder="" ></textarea>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">文章详情图片</label><br/>
                            <button type="button" class="btn btn-success depart-modal" id="add_input" style="width: 100px;">添加图片</button>
                            <table class="table table-hover" id="input_table">
                            	<thead>
                                    <tr>
                                        <th width="60%">图片链接</th>
                                        <th width="40%">操作</th>
                                    </tr>
                                </thead>
                                <tbody class="tbody-class">
                                </tbody>
                            </table>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add">文章内容</label>
                            <textarea class="xheditor" style="width: 100%;" name="content" id="content" placeholder="" ></textarea>
                        </div>
                        <input name="article_id" type="hidden" id="article_id">
                    </div>
                </form>
                <div style="display: none">
                    <?php $form = ActiveForm::begin(['id'=>'upload_form_update','action'=>'/common/img-upload'],['options' => ['enctype' => 'multipart/form-data']]) ?>
                    <?= $form->field($model, 'img_url')->fileInput(['class' => 'upload_file_ot']) ?>
                    <?php ActiveForm::end() ?>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <a type="button" class="btn btn-primary ajax_post_tag">提交</a>
            </div>
        </div>
    </div>
</div>
<?php include ('../views/seo/seo-modal.php');?>
<input type="hidden" id="check_img_val" value=""/>
<input type="hidden" id="img_type" value=""/>
<input type="hidden" name="imageBathUrl" id="imageBathUrl" value="<?php echo Yii::$app->params['imageBathUrl'] . '/' ?>">
<!-- 固定js -->
<script type="text/javascript" src="/static/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="/static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/plugins/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="/static/jBox/jquery.jBox-2.3.min.js"></script>
<script type="text/javascript" src="/static/jBox/i18n/jquery.jBox-zh-CN.js"></script>
<script type="text/javascript" src="/static/plugins/treeTable/jquery.treetable.js"></script>
<!-- 图片上传插件用 -->
<script type="text/javascript" src="/static/plugins/jquery.form.js"></script>
<!-- 图片显示用 -->
<script type="text/javascript" src="/static/plugins/layer/layer.js"></script>
<!-- 富文本框插件 -->
<script type="text/javascript" src="/static/plugins/xheditor/xheditor-1.2.2.min.js"></script>
<script type="text/javascript" src="/static/plugins/xheditor/xheditor_lang/zh-cn.js"></script>
<!-- 自定义js -->
<script type="text/javascript" src="../static/app/global.js?version=<?=Yii::$app->params['version']?>"></script>
<script type="text/javascript"  src="/static/app/article/index.js?version=<?=Yii::$app->params['version']?>"></script>
<script>
var pc_url = '<?=Yii::$app->params['pc']?>';
</script>